package com.fr.report.script.function;

import com.fr.report.script.Function;
import com.fr.report.script.Function.Type;
import com.fr.report.script.NormalFunction;

public class UUID extends NormalFunction
{
  public Object run(Object[] paramArrayOfObject)
  {
    if (paramArrayOfObject.length == 0)
      return com.fr.base.core.UUID.randomUUID().toString();
    if (paramArrayOfObject.length > 0)
    {
      Object localObject = paramArrayOfObject[0];
      if (localObject instanceof Integer)
      {
        if (!(((Integer)localObject).equals(new Integer(32))))
          break label101;
        return com.fr.base.core.UUID.randomUUID().toString().replaceAll("-", "");
      }
      if (localObject instanceof String)
      {
        if (!(localObject.toString().equals("32")))
          break label101;
        return com.fr.base.core.UUID.randomUUID().toString().replaceAll("-", "");
      }
      return com.fr.base.core.UUID.randomUUID().toString();
    }
    label101: return com.fr.base.core.UUID.randomUUID().toString();
  }

  public Function.Type getType()
  {
    return Function.OTHER;
  }

  public String getCN()
  {
    return "UUID():返回随机的UUID。\n示例:UUID()返回36位随机机器数。\n       UUID(32)返回32位随机机器数。";
  }

  public String getEN()
  {
    return "";
  }
}